import { EggAppConfig, PowerPartial } from 'egg';
import * as dotenv from 'dotenv';
dotenv.config();

export default () => {
  const config: PowerPartial<EggAppConfig> = {
    sequelize: {
      dialect: 'mysql',
      host: process.env.DEV_DB_HOST,
      port: 3306,
      database: 'intellectual-property',
      username: process.env.DEV_DB_USERNAME,
      password: process.env.DEV_DB_KEY,
      query: {
        nest: true,
      },
      define: {
        timestamps: true,
        underscored: false,
        freezeTableName: true,
      },
    },
    bodyParser: {
      jsonLimit: '50mb',

      formLimit: '50mb',
    },
    multipart: {
      fields: 50,
      fileExtensions: ['.xlsx', '.pdf'],
      fileSize: '50mb',
    },
  };

  return config;
};
